package WorkTest;

public class SampleMode {
    private static SampleMode sampleMode;
    private SampleMode(){
    }
    /*一般非空情况，不需要尝试获取锁
    * 多线程使用同一个类对象生成实例对象时，竞争获取锁
    * */
    public static SampleMode getSampleMode(){
        if (sampleMode == null) {
            synchronized (SampleMode.class) {
                if (sampleMode == null) {
                    sampleMode = new SampleMode();
                }
            }

        }
        return sampleMode;
    }

}
